TEScroll
TEScroll
Scroll text within its view rectangle short dHoriz ; distance ( pixels); <0 is left; >0 is right
short dVert ; distance ( pixels); <0 is up; >0 is down
TEScroll scrolls the text of the edit record by a specified number of pixels in any direction, within its view rectangle. The 128K ROMs TEPinScroll is somewhat smarter.
dHoriz is the number of pixels to scroll the text horizontally. Positive
values scroll the text toward the right side; negative values scroll the
text toward the left.
dVert is the number of pixels to scroll the text vertically. Positive values
scroll the text toward the bottom of the screen; negative values scroll
the text toward the top.
hTE is a handle obtained via TENew (old style TextEdit records) or TEStylNew (new style TextEdit records). It leads to a variable-length TERec structure and identifies the edit record to be affected by this change.
Notes: This scrolls text within the view rectangle, as defined in the field TERec.viewRect of the edit record. This has the effect of modifying the value of destRect in the edit record and redrawing the text.
For instance, to scroll the text downward by one line:
short distV;
distV = (*hTE)->lineHeight; /* height of a line of text */
The insertion point disappears if you call TEScroll with dHoriz and dVert set to zero. Always check dHoriz and dVert before calling TEScroll. You can set up for automatic scrolling (or any other action to be taken
while the button is held down) by using SetClikLoop to store the address of a function in the clikLoop field of the edit record.
128K ROM's function TEPinScroll is the same, but it won't scroll past the last line of the edit record. TEAutoView enables auto- scrolling (when you drag-select beyond the bottom or top of the view rectangle).